<!-- 出库管理/订单管理/查询表单 -->
<template>
  <div class="query-criteria">
    <el-form ref="form">
      <el-row>
        <el-col :span="6">
          <el-form-item label="入驻商" label-width="70px">
            <el-select style="width:100%" v-model="listQuery.shipmentName" clearable filterable placeholder="请选择入驻商">
              <el-option
                v-for="item in optionList.options"
                :key="item.partyCode"
                :label="item.userName"
                :value="item.userName">
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="波次号" label-width="80px">
            <el-input v-model="listQuery.wavePickingCode" placeholder="请输入波次号" clearable />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="来源单号" label-width="90px">
            <el-input v-model="listQuery.sourceCode" placeholder="请输入来源单号" clearable />
          </el-form-item>
        </el-col>

        <el-col :span="4">
          <el-form-item label="单据类型" label-width="90px">
            <el-select style="width: 100%" v-model="listQuery.type" placeholder="请选择单据类型" clearable>
              <el-option
                v-for="item in optionList.typeList"
                :key="item.code"
                :label="item.name"
                :value="item.code"
              />
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="6">
          <el-form-item label="承运商" label-width="70px">
            <el-select style="width: 100%" @change="carrierChange" v-model="listQuery.carrierCodeList" clearable filterable multiple collapse-tags placeholder="请选择承运商">
              <el-option
                v-for="item in optionList.carrierList"
                :key="item.code"
                :label="item.name"
                :value="item.code"
              >
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="接收时间" label-width="80px">
            <el-date-picker
              v-model="gmtCreatedRange"
              type="datetimerange"
              value-format="yyyy-MM-dd HH:mm:ss"
              style="width: 100%"
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
            />
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item label="状态" label-width="90px">
            <el-select v-model="listQuery.status" placeholder="请选择状态" clearable>
              <el-option
                v-for="item in getEnumsOrDict('enum', 'orderStatus')"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>

<script>
export default {
  name: 'QueryCriteria',
  props: {
    listQuery: {
      type: Object,
      required: true
    },
    optionList: {
      type: Object,
      required: true
    }
  },
  computed: {
    gmtCreatedRange: {
      get() {
        return this.optionList.gmtCreatedRange
      },
      set(newValue) {
        this.$emit('changeGmtCreatedRange', newValue)
      }
    }
  },
  methods: {
    // 承运商多选
    carrierChange(data) {
      this.$emit('carrierChange', data)
    }
  }
}
</script>
<style scoped>
.query-criteria{
  /* margin: 0 -14px; */
}
.form-item {
  display: flex;
}
</style>
